package com.dyb.demo;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

/***
 *
 *   █████▒█    ██  ▄████▄   ██ ▄█▀       ██████╗ ██╗   ██╗ ██████╗
 * ▓██   ▒ ██  ▓██▒▒██▀ ▀█   ██▄█▒        ██╔══██╗██║   ██║██╔════╝
 * ▒████ ░▓██  ▒██░▒▓█    ▄ ▓███▄░        ██████╔╝██║   ██║██║  ███╗
 * ░▓█▒  ░▓▓█  ░██░▒▓▓▄ ▄██▒▓██ █▄        ██╔══██╗██║   ██║██║   ██║
 * ░▒█░   ▒▒█████▓ ▒ ▓███▀ ░▒██▒ █▄       ██████╔╝╚██████╔╝╚██████╔╝
 *  ▒ ░   ░▒▓▒ ▒ ▒ ░ ░▒ ▒  ░▒ ▒▒ ▓▒       ╚═════╝  ╚═════╝  ╚═════╝
 *  ░     ░░▒░ ░ ░   ░  ▒   ░ ░▒ ▒░
 *  ░ ░    ░░░ ░ ░ ░        ░ ░░ ░
 *           ░     ░ ░      ░  ░
 */
public class Test {
    public static void main(String[] args) {
//       method1();
//       method2();
//        a(1);

        System.out.println(methodRegex("sdfwertsuiop"));
    }

    private static boolean methodRegex (String iniString) {
        // write code here
        return !iniString.matches(".*(.)(.*\\1).*");
    }

    private static int f(int n) {
        if (n == 1 || n == 2) {
            return n;
        }
        return f(n-1) + f(n-2);
    }

    private static void method1() {
        // 参加运算的两个数据，按二进制位进行“异或”运算。
        String s1 = "3";
        String s2 = "1";
        System.out.println(s1.hashCode() ^ s2.hashCode());

        int a = 1, b =2, c=3;
        System.out.println(a + b + c + "");
        System.out.println(a + b + "" + c );
        System.out.println("" + a + b + c);
        System.out.println((a+b) + "c");

        int len = 3;
        int result = len + (len >> 1);
        System.out.println(result);
    }

    private static void method2() {
        BigDecimal value = new BigDecimal("5.6789");
        value = value.setScale(2, RoundingMode.DOWN);
        System.out.println(value);
        System.out.println(Math.floor(value.doubleValue()));

    }

    private static void a (int i) {
        System.out.println("run a");
        printStackTrace(Thread.currentThread());
        b(2);
    }

    private static void b (int b) {
        System.out.println("run b");
        printStackTrace(Thread.currentThread());
    }

    private static void printStackTrace(Thread thread) {
        StackTraceElement[] stackTrace = thread.getStackTrace();
        for (int j = stackTrace.length - 1; j > 1; j--) {
            System.out.println("className:" + stackTrace[j].getClassName() +"----methodName:"+ stackTrace[j].getMethodName()
                    +"----lineNumber:"+ stackTrace[j].getLineNumber());
        }
    }



}